#ifndef WINDOW_H
#define WINDOW_H
#include <QPainter>
#include <QPixmap>
#include <QVector>
#include <Qlist>
#include <QWidget>
#include <QPainter>
#include <QPixmap>
#include <QPointF>
#include <QGraphicsScene>
#include <QPaintEvent>
#include <QMessageBox>
#include <Qtimer>
#include "starship.h"
#include <meteorites.h>
#include <QElapsedTimer>
#include <QFont>
#include <ctime>
class Window : public QWidget
{
    Q_OBJECT
public:
    explicit Window(QWidget *parent = 0);
private:
    QElapsedTimer *m_playedTimer;
    bool m_up,m_down,m_right,m_left; //кнопки на клаве
    bool m_fire;
    bool m_activePause;
    bool m_canCreateBullet;
    bool m_canCreateMeteorit;
    bool m_canStartMeteoritTimer;
    bool m_killed;
    qint32 m_prevScore,m_prevTimeMin,m_prevTimeSec,m_prevTimeMSec;
    qint32 m_frequencyMeteorits;
    qint32 m_hp;
    qint32 m_lifeTime,m_destroyedMeteorites;
    qint32 m_x, m_y;//координаты мышки
    qint32 m_xShip, m_yShip;
    double m_angleShip;
    qint32 m_score;
    qint32 tx,ty;
    QFont *font;
    QPixmap m_pixmap;
    Starship *m_ship;
    QList <Bullet*> m_listBullet;
    QList <Meteorites*> m_listMeteorites;
    //Bullet *bullet;
    double angle;
    void start ();
    void pause ();
    void addMeteorit ();
    void timerMeteorits ();
    void collisionMB();
    void collisionMS();
signals:
    void updateShip(qint32 x, qint32 y); // обновляем координаты корабля
    void transmitCursor (qint32 x, qint32 y); //передача координат курсора
private slots:
    void updateWindow();
    void updateShipInfo(qint32 x, qint32 y, double angle);
    void CreateBullet();
    void CreateMeteorit();
    void increaseFrequencyMeteorits();


protected:
    void paintEvent(QPaintEvent * e);
    void mouseMoveEvent(QMouseEvent *e);
    void mousePressEvent(QMouseEvent *e);
    void mouseReleaseEvent(QMouseEvent *e);
    void keyPressEvent(QKeyEvent *e);
    void keyReleaseEvent(QKeyEvent *e);
};

#endif // WINDOW_H
